package android.support.v4.os;

import android.util.DisplayMetrics;
import android.view.DisplayInfo;

import com.edroid.autorunner.um.UserInfo;
import com.edroid.autorunner.um.UserManager;

/**
 * 分辨率修改
 * 
 * @author YYichou 2014-8-28
 *
 */
public class EDisplayInfo extends EHook {

	@Override
	public String getClassName() {
		return DisplayInfo.class.getName();
	}

	@Override
	public void hook() {
		hookAllMethods("getMetricsWithSize");
	}
	
	@Override
	protected void after(String name, Object[] args, MethodHookParam param) {
		DisplayMetrics dm = (DisplayMetrics) args[0];

//		log.i("after " + name + " ret=" + dm);
		
		if(sHookResolution) {
			UserInfo userInfo = UserManager.currentUserInfo();
			dm.widthPixels = userInfo.screenWidth;
			dm.heightPixels = userInfo.screenHeight;
		}
	}
}
